using System;
using System.Web;

namespace THANHTUNGO.Portal.Components.Helpers
{
    public class ImageHelper
    {
        public static string GetUserImage(object status)
        {
            if (status.ToString().ToUpper() == "DEACTIVE")
            {
                return "~/Images/Icons/User_Deactive.gif";
            }
            return "~/Images/Icons/User.gif";
        }

        public static string BuildRateImage(object rate, HttpRequest request)
        {
            string returnValue = string.Empty;
            for (int i = 1; i <= 10; i++)
            {
                if (i <= Convert.ToInt32(rate))
                {
                    if (i%2 == 0)
                    {
                        returnValue += string.Format("<img src='{0}/Images/Icons/Rate/star-right-on.gif' border='0'/>", Global.GetApplicationPath(request));
                    }
                    else
                    {
                        returnValue += string.Format("<img src='{0}/Images/Icons/Rate/star-left-on.gif' border='0'/>", Global.GetApplicationPath(request));
                    }
                }
                else
                {
                    if (i%2 == 0)
                    {
                        returnValue += string.Format("<img src='{0}/Images/Icons/Rate/star-right-off.gif' border='0'/>", Global.GetApplicationPath(request));
                    }
                    else
                    {
                        returnValue += string.Format("<img src='{0}/Images/Icons/Rate/star-left-off.gif' border='0'/>", Global.GetApplicationPath(request));
                    }
                }
            }
            return returnValue;
        }
    }
}